package isoft.util;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class DatabaseUtil {
    public void one()  {
        try{
            Class.forName("com.mysql.cj.jdbc.Driver");
            String URL = "jdbc:mysql://localhost:3306/booksystem";
            String USER = "root";
            String PASSWORD = "123456";

            Connection connection = DriverManager.getConnection(URL, USER, PASSWORD);

        }catch (Exception e){
            e.printStackTrace();
        }
    }

    public static void closeConnection(Connection conn) {
        if (conn != null) {
            try {
                conn.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }
    }
}
